Skip to content

Strengthen route and MCP validation tests (codex) - #2365

Merged
numnx merged 1 commit into
feature/CODUX-143-qs-coverage-observability-and-ci-reliability-audit-3from
task/feature-codux-143-qs-coverage-observability-and--t04-codex-mr9l85pp
Jul 6, 2026
Merged

Strengthen route and MCP validation tests (codex)#2365
numnx merged 1 commit into
feature/CODUX-143-qs-coverage-observability-and-ci-reliability-audit-3from
task/feature-codux-143-qs-coverage-observability-and--t04-codex-mr9l85pp

Conversation

@numnx

@numnx numnx commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

🧩 Task: Strengthen route and MCP validation tests

Automated task PR opened by Code UX for T04.

📋 Summary

Sprint: Sprint 143 · QS: Coverage Observability and CI Reliability Audit · Task: T04

Strengthen Code UX coverage observability and CI reliability through enforceable tests, workflow hardening, structured observability guarantees, security validation, and aligned operational documentation without lowering coverage thresholds.

📝 Full Task Prompt
## Objective
Improve backend API reliability by enforcing route status mapping, MCP validation, approval envelopes, and path traversal rejection behavior.

## Scope
- `src/server/request-parsers.ts`
- `src/server/route-utils.ts`
- `src/server/http-errors.ts`
- `src/server/terminal-routes.ts`
- `src/server/file-browser-routes.ts`
- `src/server/local-directory-routes.ts`
- `tests/backend/server/request-parsers.test.ts`
- `tests/backend/server/route-utils.test.ts`
- `tests/backend/server/dashboard-routes-error.test.ts`
- `tests/backend/server/terminal-routes.test.ts`
- `tests/backend/server/file-browser-routes.test.ts`
- `tests/backend/server/local-directory-routes.test.ts`
- `tests/backend/mcp/management-payload-parsers.test.ts`
- `tests/backend/mcp/mcp-management.test.ts`
- `docs/operations/runbook.md`
- Current verification gap: many validation tests exist, but the audit calls for route validation, status mapping, approval tests, and path traversal coverage to be explicit and consistent.
- Desired guarantee: malformed inputs map to 400/403/404 responses, 500s are sanitized, destructive MCP actions require non-reused approval, and path traversal never reaches filesystem/provider boundaries.

## Implementation Requirements
1. Add focused parser tests for empty strings, nullable fields, invalid enums, integer bounds, and boolean coercion in `tests/backend/server/request-parsers.test.ts`.
2. Extend route utility/error tests to assert validation errors produce client statuses while unexpected errors produce sanitized `Internal Server Error` responses and still call `next(error)`.
3. Add or extend path traversal tests for terminal, file browser, and local directory routes so `..`, encoded separators, absolute paths, and provider config IDs with separators are rejected before filesystem access.
4. Extend MCP payload and management tests to prove destructive actions require approval, mismatched or reused approval payloads fail, and parser errors are consistently shaped.
5. Update `docs/operations/runbook.md` with the validation/security behavior operators should expect when hostile paths or malformed management calls are rejected.

## Constraints
- Preserve existing public route contracts and error shapes unless tests reveal an actual inconsistency.
- Do not expose raw error messages for 500-level failures.
- Do not weaken MCP approval requirements for destructive actions.
- Mock filesystem, Docker, provider, and repository boundaries where route tests do not need real IO.

## Verification
- `pnpm run test:backend -- tests/backend/server/request-parsers.test.ts tests/backend/server/route-utils.test.ts tests/backend/server/dashboard-routes-error.test.ts tests/backend/server/terminal-routes.test.ts tests/backend/server/file-browser-routes.test.ts tests/backend/server/local-directory-routes.test.ts tests/backend/mcp/management-payload-parsers.test.ts tests/backend/mcp/mcp-management.test.ts`
- `pnpm run test:backend`
- `pnpm run lint`
- Success means invalid requests fail with intended statuses, 500s stay sanitized, approvals cannot be bypassed, and traversal attempts do not touch external state.

✅ QA Review

⏳ QA review runs after this PR is opened. Check the task card in the dashboard for the outcome once it lands.

🤖 Model & Provider

Provider Codex CLI
Model gpt-5.5

⏱️ Timing

Started 2026-07-06 19:03:00 UTC
Finished 2026-07-06 19:11:53 UTC
Duration 8m 53s

📊 Token Usage

Metric Value
Input tokens 122,437
Cached input tokens 2,078,464
Output tokens 12,156
Total tokens 2,213,057
Invocations 1
Tool calls 59
Active time 7m 34s

Included usage estimate (subscription/local login): $2.02

🌿 Branch Info

Base: feature/CODUX-143-qs-coverage-observability-and-ci-reliability-audit-3
Head: task/feature-codux-143-qs-coverage-observability-and--t04-codex-mr9l85pp


🤖 Generated by Code UX

@numnx
numnx merged commit a4d0b8d into feature/CODUX-143-qs-coverage-observability-and-ci-reliability-audit-3 Jul 6, 2026
6 checks passed
@numnx
numnx deleted the task/feature-codux-143-qs-coverage-observability-and--t04-codex-mr9l85pp branch July 6, 2026 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant